import requests
from bs4 import BeautifulSoup

if __name__ == "__main__":
    while True:
        # 请求的URL
        url = 'https://fanyi.baidu.com/sug'
        # UA伪装
        headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36'
        }
        word = input("请输入单词：")
        data = {"kw": word}
        respones = requests.get(url=url, headers=headers, params=data)
        respones.encoding = 'utf-8'
        print(respones.json())
